﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using JChatSerVices.GetConnect;
using JChatSerVices.UserService;
using JChatData.Helper;
using JChatAdmin.Models.CityCountryModel;
namespace JChatAdmin.Controllers
{
    public class ListCityController : Controller
    {
        //
        // GET: /ListCity/
        GetFileConnect _get;
        DBConectString _db;
        JChatSerVices.CityService.CityService _city;
        UserService _user;
        public ListCityController()
        {
            _city = new JChatSerVices.CityService.CityService();
            _user = new UserService();
            _get = new GetFileConnect();
            string file = _get.GetFile("conn");
            _db = new DBConectString(file);
        }
        [HttpGet]
        public ActionResult ListCity()
        {
            var a = (from ct in _db._context.JChat_City
                     join ctr in _db._context.JChat_CounTry
                     on ct.CounTryID equals ctr.CountryID
                     select new CityCountryModel
                     {
                         CityID = ct.CityID,
                         NameCountry = ctr.NameCountry,
                         NameCity = ct.NameCity,
                     });
            return View(a);
        }

    }
}
